namespace BoxPlayer
{
    class T_Box_Player_Context;
};

#ifndef T_BOX_PLAYER_H
#define T_BOX_PLAYER_H

#include "stable.h"
#include "t_box.h"
#include "t_av_packet.h"
#include "t_box_audio.h"
#include "t_box_bar.h"

namespace BoxPlayer
{
    class T_Box_Player_Context : public QObject
    {
        Q_OBJECT
    protected:
        class T_Box_Player_ContextPrivate *d_ptr;
        Q_DECLARE_PRIVATE(T_Box_Player_Context);
    public:
        T_Box_Core *m_core;
        T_Box_AudioOutput *m_speaker;
        T_VideoProgressBar *m_seek_bar;
        T_BufferProgressBar *m_buffering_bar;
        T_AVPicture m_video_decode_buff;
    public:
        explicit T_Box_Player_Context(T_Box_Core *a_core);
        virtual ~T_Box_Player_Context();
        T_Box_Media *audio();
        T_Box_Media *video();
        bool needBuffering();
        T_Box_AudioOutput *speaker();
        void start();
        void finish();
       T_SharedPointerQueue<T_AV_Packet> *videoPacketQueue();
    protected:
        friend class T_Box_Player_Decode_Thread;
        class T_Box_Player_Decode_Thread *m_decode_thread;
    };

    class T_Box_Player_Decode_Thread : public T_Box_Thread
    {
    protected:
        T_Box_Media *m_video;
    public:
        explicit T_Box_Player_Decode_Thread(T_Box_Media *a_video)
            : m_video(a_video)
        {
        }
    protected:
        virtual void run();
    };

};
#endif // T_BOX_PLAYER_H
